package com.books.mapper.common;

import com.books.model.entity.backcontroller.Vip;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author 饿熊的咆哮
 * @Date 2021/9/28 19:02
 * @Version 1.0
 */
@Mapper
public interface VipMapper {
    @Select("select * from vip")
    List<Vip> findAll();

    @Select("select * from vip where vip_id=#{vipId}")
    Vip findByVipId(Integer vipId);

    @Select("select * from vip where vip_name like '%${vipName}%'")
    List<Vip> findByVipName(String vipName);

    @Insert("insert into vip values(null,#{vipName},#{vipPrice},#{vipDescribe})")
    void addVip(Vip vip);

    @Update("Update vip set vip_price=#{vip.vipPrice},vip_describe=#{vip.vipDescribe} where vip_id=#{vipId}")
    void updateVip(Vip vip,Integer vipId);

}
